package com.cskaoyan.javase.oop1._5this;

/**
 * this关键字用来区分成员方法中同名的成员变量和形参名
 *      一般用在给成员变量赋值的方法中.
 *
 * @since 17:31
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo2 {
    public static void main(String[] args) {
        Teacher t = new Teacher();
        System.out.println(t.salary);

        t.setSalary(1000000);
        System.out.println(t.salary);
    }
}

class Teacher {
    double salary;

    // 成员方法,给成员变量salary赋值
    public void setSalary(double salary) {
        this.salary = salary;
    }
}